package com.cinema.data;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class Ticket implements Serializable{
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key ID;
	
	@Persistent
	private int tid;
	
	@Persistent
	private long usrid;
	
	@Persistent(serialized = "true")
	private int[] seatno;
	
	@Persistent
	private Date bookday;
	
	@Persistent
	private String booktime;
	
	@Persistent
	private int tickettype;
	
	@Persistent
	private long filmid;
	
	private int seatQty;
	
	public Ticket(long usrid, int[] seatno, Date bookday, int tickettype, long filmid){
		this.usrid = usrid;
		this.seatno = seatno;
		this.bookday = bookday;
		this.setTickettype(tickettype);
		this.filmid = filmid;
	}
	public Ticket() {
		// TODO Auto-generated constructor stub
	}
	public Key getID() {
		return ID;
	}

	public void setID(Key iD) {
		ID = iD;
	}

	public long getUsrid() {
		return usrid;
	}

	public void setUsrid(long usrid) {
		this.usrid = usrid;
	}

	public int[] getSeatno() {
		return seatno;
	}

	public void setSeatno(int[] seatno) {
		this.seatno = seatno;
	}

	public Date getBookday() {
		return bookday;
	}

	public void setBookday(Date bookday) {
		this.bookday = bookday;
	}

	public long getFilmid() {
		return filmid;
	}

	public void setFilmid(long filmid) {
		this.filmid = filmid;
	}
	public String getBooktime() {
		return booktime;
	}
	public void setBooktime(String booktime) {
		this.booktime = booktime;
	}
	public int getTid() {
		return tid;
	}
	public void setTid(int tid) {
		this.tid = tid;
	}
	public int getSeatQty() {
		return seatno.length;
	}
	public void setSeatQty(int seatQty) {
		this.seatQty = seatQty;
	}
	public int getTickettype() {
		return this.tickettype;
	}
	public void setTickettype(int tickettype) {
		this.tickettype = tickettype;
	}
}
